import request from '@/utils/request'

// 查询提案列表
export function listProposals(query) {
  return request({
    url: '/proposal/manage',
    method: 'get',
    params: query
  })
}

// 查询提案详细
export function getProposal(id) {
  return request({
    url: '/proposal/manage/' + id,
    method: 'get'
  })
}

// 新增提案
export function addProposal(data) {
  return request({
    url: '/proposal/manage',
    method: 'post',
    data: data
  })
}

// 修改提案
export function updateProposal(data) {
  return request({
    url: '/proposal/manage',
    method: 'put',
    data: data
  })
}

// 删除提案
export function delProposal(id) {
  return request({
    url: '/proposal/manage/' + id,
    method: 'delete'
  })
}

// 批量删除提案
export function delProposalsBatch(ids) {
  return request({
    url: '/proposal/manage/batch',
    method: 'delete',
    data: { ids: ids }
  })
}

// 查询需要财务审核的提案列表
export function listFinanceProposals(query) {
  return request({
    url: '/proposal/finance/list',
    method: 'get',
    params: query
  })
}

// 更新财务节省金额
export function updateFinanceSavings(data) {
  return request({
    url: '/proposal/finance/savings',
    method: 'put',
    data: data
  })
}

// 查询需要评分的提案列表
export function listScoreProposals(query) {
  return request({
    url: '/proposal/score/list',
    method: 'get',
    params: query
  })
}

// 提交评分
export function submitScore(data) {
  return request({
    url: '/proposal/score',
    method: 'post',
    data: data
  })
}

// 提交提案
export function submitProposal(data) {
  return request({
    url: '/proposal/submit/submit',
    method: 'post',
    data: data
  })
}